home *** CD-ROM | disk | FTP | other *** search
/ Programmers Heaven 2 / Programmers Heaven 2.iso / files / windows / ocx / ipack.exe / SEND1.FRM (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1997-07-18  |  5.5 KB  |  168 lines

  1. VERSION 4.00
  2. Begin VB.Form Form1 
  3.    Caption         =   "Form1"
  4.    ClientHeight    =   2385
  5.    ClientLeft      =   3720
  6.    ClientTop       =   3150
  7.    ClientWidth     =   3825
  8.    Height          =   2790
  9.    Left            =   3660
  10.    LinkTopic       =   "Form1"
  11.    LockControls    =   -1  'True
  12.    MaxButton       =   0   'False
  13.    MinButton       =   0   'False
  14.    ScaleHeight     =   2385
  15.    ScaleWidth      =   3825
  16.    Top             =   2805
  17.    Width           =   3945
  18.    Begin VB.Frame Frame1 
  19.       Caption         =   "Send Attachment"
  20.       Height          =   2175
  21.       Left            =   120
  22.       TabIndex        =   0
  23.       Top             =   120
  24.       Width           =   3615
  25.       Begin VB.CommandButton Command1 
  26.          Caption         =   "Send Attachment"
  27.          Height          =   375
  28.          Left            =   1320
  29.          TabIndex        =   4
  30.          Top             =   1560
  31.          Width           =   2055
  32.       End
  33.       Begin VB.TextBox Text3 
  34.          Height          =   285
  35.          Left            =   1320
  36.          TabIndex        =   3
  37.          Top             =   1080
  38.          Width           =   2055
  39.       End
  40.       Begin VB.TextBox Text2 
  41.          Height          =   285
  42.          Left            =   1320
  43.          TabIndex        =   2
  44.          Top             =   720
  45.          Width           =   2055
  46.       End
  47.       Begin VB.TextBox Text1 
  48.          Height          =   285
  49.          Left            =   1320
  50.          TabIndex        =   1
  51.          Top             =   360
  52.          Width           =   2055
  53.       End
  54.       Begin MailLib.mMail Mail1 
  55.          Left            =   120
  56.          Top             =   1560
  57.          _Version        =   327680
  58.          _ExtentX        =   847
  59.          _ExtentY        =   847
  60.          _StockProps     =   0
  61.          Blocking        =   -1  'True
  62.          Debug           =   0
  63.          Host            =   ""
  64.          Timeout         =   0
  65.          ConnectType     =   0
  66.          PopPort         =   110
  67.          SmtpPort        =   25
  68.       End
  69.       Begin VB.Label Label3 
  70.          Alignment       =   1  'Right Justify
  71.          Caption         =   "File:"
  72.          Height          =   255
  73.          Left            =   360
  74.          TabIndex        =   7
  75.          Top             =   1080
  76.          Width           =   855
  77.       End
  78.       Begin VB.Label Label2 
  79.          Alignment       =   1  'Right Justify
  80.          Caption         =   "SMTP Server:"
  81.          Height          =   255
  82.          Left            =   120
  83.          TabIndex        =   6
  84.          Top             =   720
  85.          Width           =   1095
  86.       End
  87.       Begin VB.Label Label1 
  88.          Alignment       =   1  'Right Justify
  89.          Caption         =   "To:"
  90.          Height          =   255
  91.          Left            =   360
  92.          TabIndex        =   5
  93.          Top             =   360
  94.          Width           =   855
  95.       End
  96.    End
  97. Attribute VB_Name = "Form1"
  98. Attribute VB_Creatable = False
  99. Attribute VB_Exposed = False
  100. Private Sub Command1_Click()
  101.     Dim boundary As Double
  102.     On Error GoTo Some_Err
  103.     Mail1.Debug = 1
  104.     'create a new message
  105.     Mail1.Action = MailActionNewMessage
  106.     Mail1.Date = Format$(Now(), "ddd, dd mmm yyyy hh:mm:ss")
  107.     Mail1.From = "You"
  108.     Mail1.EMailAddress = "you@yourdomain.com"
  109.     Mail1.To = Text1.Text
  110.     Mail1.Subject = "Example of attachments"
  111.     'create the headers for the message
  112.     '
  113.     'each multi-part message must have the 'parts'
  114.     'separated by a unique boundry.
  115.     boundary = Fix(Rnd * 100000000000#)
  116.     Mail1.ContentType = "multipart"
  117.     Mail1.ContentSubtype = "mixed"
  118.     Mail1.ContentSubtypeParameters = "boundary=" & CStr(boundary) & "_boundary"
  119.     Mail1.MultipartBoundary = CStr(boundary) & "_boundary"
  120.     'this is a zip attachment 'part'
  121.     Mail1.Action = MailActionCreatePart
  122.     Mail1.Action = MailActionDescend
  123.     Mail1.ContentType = "application"
  124.     Mail1.ContentSubtype = "x-zip-compressed"
  125.     Mail1.ContentSubtypeParameters = "name=" & Chr$(34) & _
  126.         "my.zip" & Chr$(34)
  127.     Mail1.ContentTransferEncoding = "base64"
  128.     Mail1.ContentDisposition = "attachment; filename=" & Chr$(34) & "my.zip" & Chr$(34)
  129.     Mail1.Flags = MailSrcIsFile Or MailDstIsBody
  130.     Mail1.SrcFilename = Text3.Text
  131.     Mail1.Action = MailActionEncode
  132.     Mail1.Action = MailActionAscend
  133.     'create the text 'part' of the message
  134.     Mail1.Action = MailActionCreatePart
  135.     Mail1.Action = MailActionDescend
  136.     Mail1.ContentType = "text"
  137.     Mail1.ContentSubtype = "plain"
  138.     Mail1.ContentSubtypeParameters = "charset=us-ascii"
  139.     Mail1.ContentTransferEncoding = "7bit"
  140.     Mail1.Body(0) = "This is the text 'part'"
  141.     Mail1.Action = MailActionAscend
  142.     'basic host configuration
  143.     Mail1.Blocking = True
  144.     Mail1.Host = Text2.Text
  145.     Mail1.ConnectType = MailConnectTypeSMTP
  146.     'send the message
  147.     Command1.Enabled = False
  148.     MousePointer = 11
  149.     Mail1.Action = MailActionConnect
  150.     Mail1.Flags = MailDstIsHost
  151.     Mail1.Action = MailActionWriteMessage
  152.     Mail1.Action = MailActionDisconnect
  153.     MousePointer = 0
  154.     Command1.Enabled = True
  155.     Exit Sub
  156. Some_Err:
  157.     MsgBox CStr(Err.Number) & " " & Err.Description
  158.     On Error Resume Next
  159.     Mail1.Action = MailActionDisconnect
  160.     MousePointer = 0
  161.     Command1.Enabled = True
  162. End Sub
  163. Private Sub Form_Load()
  164. End Sub
  165. Private Sub Mail1_Debug(ByVal Message As String)
  166.     Debug.Print Message
  167. End Sub
  168.